package com.wondream.myframework.design_pattern.behavior;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.util.LinkedList;
import java.util.List;

@AllArgsConstructor
@NoArgsConstructor
public class Excel {
    private List<IAction> actions = new LinkedList<>();

    public void record(IAction action) {
        actions.add(action);
    }

    public void run(){
        actions.forEach(
                action -> action.perform()
        );
    }

    public static void main(String[] args) {
        Excel excel = new Excel();
        excel.record(new OpenAction());
        excel.record(new SaveAction());
        excel.record(new CloseAction());
        excel.run();
    }
}
